﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sinacor.Infra.UI.Common;

namespace Sinacor.UI.Bovespa.Contabil.Communication.Translator.DataContractToModel
{
    public class Calendario
    {
        #region Construtor

        /// <summary>
        /// Construtor padrão
        /// </summary>
        public Calendario() { }

        #endregion

        #region Metodos

        /// <summary>
        /// ToCalendario
        /// </summary>
        /// <param name="from"></param>
        /// <returns></returns>
        public Model.Calendario ToCalendario(Communication.Bovespa.ManutencaoOrdens.Calendario.CalendarioResponse from)
        {
            if (from == null) return null;

            return new Model.Calendario
            {
                DataPregao = from.DataPregao
            };
        }

        /// <summary>
        /// ToCalendario - LIST
        /// </summary>
        /// <param name="from"></param>
        /// <returns></returns>
        public ModelCollection<Model.Calendario> ToCalendario(List<Communication.Bovespa.ManutencaoOrdens.Calendario.CalendarioResponse> from)
        {
            ModelCollection<Model.Calendario> lista = new ModelCollection<Sinacor.UI.Bovespa.Contabil.Model.Calendario>();

            if (from == null) return null;

            foreach (Communication.Bovespa.ManutencaoOrdens.Calendario.CalendarioResponse item in from)
            {
                lista.Add(this.ToCalendario(item));
            }

            return lista;
        }

        #endregion
    }
}
